﻿@model Solution.Data.Article
@{
    ViewBag.Title = "FormEdit";
    Layout = "~/Areas/Admin/Views/Shared/_LayoutAdmin.cshtml";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/ckeditor/ckeditor.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(function () { InitMenuID(1, 0); });		
</script>
<h1>
    <img src="@Url.Content("~/Areas/Admin/Content/Images/icon/file_32x32.png")" alt="">
    Article Edit
</h1>
<div class="bloc">
    <div class="content">
        <div class="error">@ViewBag.Err</div>
        @using (Html.BeginForm("EditAdvance", "AtcArticleCP", FormMethod.Post, new { enctype = "multipart/form-data" }))
        {
            @Html.ValidationSummary(true)
            <fieldset class="article">
                @Html.HiddenFor(model => model.Id)
                <div class="clear">
                </div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Alias)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Alias)
                    @Html.ValidationMessageFor(model => model.Alias)
                </div>
                <div class="clear">
                </div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Name)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Name)
                    @Html.ValidationMessageFor(model => model.Name)
                </div>
                <div class="clear">
                </div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Title)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Title)
                    @Html.ValidationMessageFor(model => model.Title)
                </div>
                <div class="clear">
                </div>
                <div class="editor-label">
                    <label>
                        Category</label>
                </div>
                <div class="editor-field">
                    @*   @Html.EditorFor(model => model.CategoryId)
                    @Html.ValidationMessageFor(model => model.CategoryId)*@
                    @Html.DropDownList("CategoryId", new SelectList(ViewBag.Categories, "Id", "DisplayName"), Model.CategoryId)
                </div>
                <div class="clear">
                </div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.ShowComment)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.ShowComment)
                    @Html.ValidationMessageFor(model => model.ShowComment)
                </div>
                <div class="clear">
                </div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Author)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Author)
                    @Html.ValidationMessageFor(model => model.Author)
                </div>
                <div class="clear">
                </div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.flag)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.flag)
                    @Html.ValidationMessageFor(model => model.flag)
                </div>
                <div class="clear">
                </div>
                <div class="editor-label">
                    <label>
                        Image</label>
                </div>
                <div class="editor-field">
                    @* @Html.EditorFor(model => model.ImageLink)
                    @Html.ValidationMessageFor(model => model.ImageLink)*@
                    <img src="@Url.Content("~/Content/Data/ArticleImg/Thumb/" + Model.ImageLink)" alt="" />
                    <input id="ImageLink" name="ImageLink" type="file" />
                </div>

                 <div class="clear">
                </div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Lead)
                </div>
                <div class="editor-field">
                    @Html.TextAreaFor(model => model.Lead)
                    @Html.ValidationMessageFor(model => model.Lead)
                </div>

                <div class="clear">
                </div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Detail)
                </div>
                <div class="editor-field">
                    @Html.TextAreaFor(model => model.Detail)
                    @Html.ValidationMessageFor(model => model.Detail)
                </div>
                <div class="clear">
                </div>
                <div>
                    <p>
                        <input type="submit" value="Save" />
                        <input type="reset" value="Reset" />
                        <input type="button" value="Back" onclick="$(location).attr('href','@Url.Action("index")/');" />
                    </p>
                </div>
            </fieldset>
        }
    </div>
</div>
<div>
</div>
<script type="text/javascript">
    var url1 = '@Url.Action("index", "CkUploadImage", new { area = "more" })';
    var url2 = '@Url.Action("index", "CkUploadImage", new { area = "more" })';
    var url3 = '@Url.Content("~/Handler/UploadImage.ashx")';
    CKEDITOR.replace('Detail', {
        filebrowserImageBrowseUrl: url1,
        filebrowserUploadUrl: url2,
        filebrowserImageWindowWidth: '780',
        filebrowserImageWindowHeight: '645',
        //skin : 'chris',
        //skin : 'black',
        width: 900,
        skin: 'kama',
        //skin : 'office2003',
        //skin : 'v2',
        height: '500',
        toolbar: 'Article',
        uiColor: '#dfdfdf',
        dialog_backgroundCoverColor: '#000',
        dialog_backgroundCoverOpacity: 0.3,
        // filebrowserBrowseUrl : '/browser/browse.php',
        // filebrowserImageBrowseUrl :url3,
        // filebrowserUploadUrl : '/uploader/upload.php',
        filebrowserImageUploadUrl: url3
    });
</script>
